﻿using System;

namespace QuarryPlanner.Domain.Entities
{
    // Author: Ryan Redburn
    // Created: 10/20/2014

    #region [ Updates ]

    // Author: Ryan Redburn
    // Date: 11/18/2014
    // Revision: Added the Notes property.

    #endregion

    /// <summary>
    /// Class used to represent the Quarry Hours report.
    /// </summary>
    public sealed class QuarryHours
    {
        #region [ Fields ]

        private int _aboveGroundHours;
        private int _belowGroundHours;
        private int _numberOfEmployees;

        #endregion

        #region [ Properties ]

        /// <summary>
        /// Database generated ID.
        /// </summary>
        public int QuarryHoursID { get; set; }

        /// <summary>
        /// Hours spent above ground.
        /// </summary>
        public int AboveGroundHours
        {
            get { return _aboveGroundHours; }
            set
            {
                if (value >= 0)
                {
                    _aboveGroundHours = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("AboveGroundHours", "AboveGroundHours cannot be less than zero.");
                }
            }
        }

        /// <summary>
        /// Hours spent below ground.
        /// </summary>
        public int BelowGroundHours
        {
            get { return _belowGroundHours; }
            set
            {
                if (value >= 0)
                {
                    _belowGroundHours = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("BelowGroundHours", "BelowGroundHours cannot be less than zero.");
                }
            }
        }

        /// <summary>
        /// Number of employees involved.
        /// </summary>
        public int NumberOfEmployees
        {
            get { return _numberOfEmployees; }
            set
            {
                if (value >= 0)
                {
                    _numberOfEmployees = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("NumberOfEmployees", "NumberOfEmployees cannot be less than zero.");
                }
            }
        }

        /// <summary>
        /// Any report notes.
        /// </summary>
        public string Notes { get; set; }

        /// <summary>
        /// Date the report was filled out.
        /// </summary>
        public DateTime DateAdded { get; set; }

        #endregion

        #region [ Constructors ]

        /// <summary>
        /// Creates an instance of QuarryHours.
        /// </summary>
        public QuarryHours() { }

        /// <summary>
        /// Creates an instance of QuarryHours using the given information.
        /// </summary>
        /// <param name="aboveGroundHours">Hours spent above ground.</param>
        /// <param name="belowGroundHours">Hours spent below ground.</param>
        /// <param name="numberOfEmployees">Number of employees involved.</param>
        /// <param name="dateAdded">Date the report was filled out.</param>
        public QuarryHours(int aboveGroundHours, int belowGroundHours, int numberOfEmployees, DateTime dateAdded) 
        {
            AboveGroundHours = aboveGroundHours;
            BelowGroundHours = belowGroundHours;
            NumberOfEmployees = numberOfEmployees;
            DateAdded = dateAdded;
        }

        #endregion

        #region [ Methods ]

        #endregion
    }
}
